From 64049b2d7c48f144e83e83f3bedac3dd8c46f146 Mon Sep 17 00:00:00 2001 From: Jeff Waugh Date: Mon, 29 Jun 2015 16:19:17 +1000 Subject: [PATCH] Use gcc crate in native build script example --- src/doc/build-script.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/doc/build-script.md b/src/doc/build-script.md index bdc7350b3..57e5bf7c0 100644 --- a/src/doc/build-script.md +++ b/src/doc/build-script.md @@ -350,17 +350,25 @@ portable, and standardized. For example, the build script could be written as: ```rust,ignore // build.rs -// Bring in a dependency on an externally maintained `cc` package which manages +// Bring in a dependency on an externally maintained `gcc` package which manages // invoking the C compiler. -extern crate cc; +extern crate gcc; fn main() { - cc::compile_library("libhello.a", &["src/hello.c"]).unwrap(); + gcc::compile_library("libhello.a", &["src/hello.c"]).unwrap(); } ``` -This example is a little hand-wavy, but we can assume that the `cc` crate -performs tasks such as: +Add a build time dependency on the `gcc` crate with the following addition to +your `Cargo.toml`: + +```toml +[build-dependencies] +gcc = "0.3" +``` + +The [`gcc` crate](https://crates.io/crates/gcc) abstracts a range of build +script requirements for C code: * It invokes the appropriate compiler (MSVC for windows, `gcc` for MinGW, `cc` for Unix platforms, etc). -- 2.30.2